{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Inspecting a DataFrame Object\n",
    "We will be working with the `data/earthquakes.csv` file again, so we need to handle our imports and read it in.\n",
    "\n",
    "## About the Data\n",
    "In this notebook, we will be working with Earthquake data from September 18, 2018 - October 13, 2018 (obtained from the US Geological Survey (USGS) using the [USGS API](https://earthquake.usgs.gov/fdsnws/event/1/))\n",
    "\n",
    "## Setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "df = pd.read_csv('data/earthquakes.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Examining dataframes\n",
    "### Is it empty?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.empty"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### What are the dimensions?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(9332, 26)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### What does the data look like?\n",
    "View rows from the top with `head()`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>alert</th>\n",
       "      <th>cdi</th>\n",
       "      <th>code</th>\n",
       "      <th>detail</th>\n",
       "      <th>dmin</th>\n",
       "      <th>felt</th>\n",
       "      <th>gap</th>\n",
       "      <th>ids</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>...</th>\n",
       "      <th>sources</th>\n",
       "      <th>status</th>\n",
       "      <th>time</th>\n",
       "      <th>title</th>\n",
       "      <th>tsunami</th>\n",
       "      <th>type</th>\n",
       "      <th>types</th>\n",
       "      <th>tz</th>\n",
       "      <th>updated</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>37389218</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.008693</td>\n",
       "      <td>NaN</td>\n",
       "      <td>85.0</td>\n",
       "      <td>,ci37389218,</td>\n",
       "      <td>1.35</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ci,</td>\n",
       "      <td>automatic</td>\n",
       "      <td>1539475168010</td>\n",
       "      <td>M 1.4 - 9km NE of Aguanga, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,geoserve,nearby-cities,origin,phase-data,</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1539475395144</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>37389202</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.020030</td>\n",
       "      <td>NaN</td>\n",
       "      <td>79.0</td>\n",
       "      <td>,ci37389202,</td>\n",
       "      <td>1.29</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ci,</td>\n",
       "      <td>automatic</td>\n",
       "      <td>1539475129610</td>\n",
       "      <td>M 1.3 - 9km NE of Aguanga, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,geoserve,nearby-cities,origin,phase-data,</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1539475253925</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>4.4</td>\n",
       "      <td>37389194</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.021370</td>\n",
       "      <td>28.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>,ci37389194,</td>\n",
       "      <td>3.42</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ci,</td>\n",
       "      <td>automatic</td>\n",
       "      <td>1539475062610</td>\n",
       "      <td>M 3.4 - 8km NE of Aguanga, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,dyfi,focal-mechanism,geoserve,nearby-cities,o...</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1539536756176</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>37389186</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.026180</td>\n",
       "      <td>NaN</td>\n",
       "      <td>39.0</td>\n",
       "      <td>,ci37389186,</td>\n",
       "      <td>0.44</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ci,</td>\n",
       "      <td>automatic</td>\n",
       "      <td>1539474978070</td>\n",
       "      <td>M 0.4 - 9km NE of Aguanga, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,geoserve,nearby-cities,origin,phase-data,</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1539475196167</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73096941</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.077990</td>\n",
       "      <td>NaN</td>\n",
       "      <td>192.0</td>\n",
       "      <td>,nc73096941,</td>\n",
       "      <td>2.16</td>\n",
       "      <td>md</td>\n",
       "      <td>...</td>\n",
       "      <td>,nc,</td>\n",
       "      <td>automatic</td>\n",
       "      <td>1539474716050</td>\n",
       "      <td>M 2.2 - 10km NW of Avenal, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,geoserve,nearby-cities,origin,phase-data,scit...</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1539477547926</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  alert  cdi      code                                             detail  \\\n",
       "0   NaN  NaN  37389218  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "1   NaN  NaN  37389202  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "2   NaN  4.4  37389194  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "3   NaN  NaN  37389186  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "4   NaN  NaN  73096941  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "\n",
       "       dmin  felt    gap           ids   mag magType  \\\n",
       "0  0.008693   NaN   85.0  ,ci37389218,  1.35      ml   \n",
       "1  0.020030   NaN   79.0  ,ci37389202,  1.29      ml   \n",
       "2  0.021370  28.0   21.0  ,ci37389194,  3.42      ml   \n",
       "3  0.026180   NaN   39.0  ,ci37389186,  0.44      ml   \n",
       "4  0.077990   NaN  192.0  ,nc73096941,  2.16      md   \n",
       "\n",
       "                         ...                          sources     status  \\\n",
       "0                        ...                             ,ci,  automatic   \n",
       "1                        ...                             ,ci,  automatic   \n",
       "2                        ...                             ,ci,  automatic   \n",
       "3                        ...                             ,ci,  automatic   \n",
       "4                        ...                             ,nc,  automatic   \n",
       "\n",
       "            time                          title  tsunami        type  \\\n",
       "0  1539475168010  M 1.4 - 9km NE of Aguanga, CA        0  earthquake   \n",
       "1  1539475129610  M 1.3 - 9km NE of Aguanga, CA        0  earthquake   \n",
       "2  1539475062610  M 3.4 - 8km NE of Aguanga, CA        0  earthquake   \n",
       "3  1539474978070  M 0.4 - 9km NE of Aguanga, CA        0  earthquake   \n",
       "4  1539474716050  M 2.2 - 10km NW of Avenal, CA        0  earthquake   \n",
       "\n",
       "                                               types     tz        updated  \\\n",
       "0         ,geoserve,nearby-cities,origin,phase-data, -480.0  1539475395144   \n",
       "1         ,geoserve,nearby-cities,origin,phase-data, -480.0  1539475253925   \n",
       "2  ,dyfi,focal-mechanism,geoserve,nearby-cities,o... -480.0  1539536756176   \n",
       "3         ,geoserve,nearby-cities,origin,phase-data, -480.0  1539475196167   \n",
       "4  ,geoserve,nearby-cities,origin,phase-data,scit... -480.0  1539477547926   \n",
       "\n",
       "                                                 url  \n",
       "0  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "1  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "2  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "3  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "4  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "\n",
       "[5 rows x 26 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "View rows from the bottom with `tail()`. Let's view 2 rows:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>alert</th>\n",
       "      <th>cdi</th>\n",
       "      <th>code</th>\n",
       "      <th>detail</th>\n",
       "      <th>dmin</th>\n",
       "      <th>felt</th>\n",
       "      <th>gap</th>\n",
       "      <th>ids</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>...</th>\n",
       "      <th>sources</th>\n",
       "      <th>status</th>\n",
       "      <th>time</th>\n",
       "      <th>title</th>\n",
       "      <th>tsunami</th>\n",
       "      <th>type</th>\n",
       "      <th>types</th>\n",
       "      <th>tz</th>\n",
       "      <th>updated</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>9330</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>38063959</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.01865</td>\n",
       "      <td>NaN</td>\n",
       "      <td>61.0</td>\n",
       "      <td>,ci38063959,</td>\n",
       "      <td>1.10</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ci,</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1537229545350</td>\n",
       "      <td>M 1.1 - 9km NE of Aguanga, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,focal-mechanism,geoserve,nearby-cities,origin...</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1537230211640</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9331</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>38063935</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>0.01698</td>\n",
       "      <td>NaN</td>\n",
       "      <td>39.0</td>\n",
       "      <td>,ci38063935,</td>\n",
       "      <td>0.66</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ci,</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>1537228864470</td>\n",
       "      <td>M 0.7 - 9km NE of Aguanga, CA</td>\n",
       "      <td>0</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,focal-mechanism,geoserve,nearby-cities,origin...</td>\n",
       "      <td>-480.0</td>\n",
       "      <td>1537305830770</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     alert  cdi      code                                             detail  \\\n",
       "9330   NaN  NaN  38063959  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "9331   NaN  NaN  38063935  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "\n",
       "         dmin  felt   gap           ids   mag magType  \\\n",
       "9330  0.01865   NaN  61.0  ,ci38063959,  1.10      ml   \n",
       "9331  0.01698   NaN  39.0  ,ci38063935,  0.66      ml   \n",
       "\n",
       "                            ...                          sources    status  \\\n",
       "9330                        ...                             ,ci,  reviewed   \n",
       "9331                        ...                             ,ci,  reviewed   \n",
       "\n",
       "               time                          title  tsunami        type  \\\n",
       "9330  1537229545350  M 1.1 - 9km NE of Aguanga, CA        0  earthquake   \n",
       "9331  1537228864470  M 0.7 - 9km NE of Aguanga, CA        0  earthquake   \n",
       "\n",
       "                                                  types     tz        updated  \\\n",
       "9330  ,focal-mechanism,geoserve,nearby-cities,origin... -480.0  1537230211640   \n",
       "9331  ,focal-mechanism,geoserve,nearby-cities,origin... -480.0  1537305830770   \n",
       "\n",
       "                                                    url  \n",
       "9330  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "9331  https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "\n",
       "[2 rows x 26 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.tail(2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### What columns do we have?\n",
    "We know there are 26 columns, but we can't see them all."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['alert', 'cdi', 'code', 'detail', 'dmin', 'felt', 'gap', 'ids', 'mag',\n",
       "       'magType', 'mmi', 'net', 'nst', 'place', 'rms', 'sig', 'sources',\n",
       "       'status', 'time', 'title', 'tsunami', 'type', 'types', 'tz', 'updated',\n",
       "       'url'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### What data types do we have?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "alert       object\n",
       "cdi        float64\n",
       "code        object\n",
       "detail      object\n",
       "dmin       float64\n",
       "felt       float64\n",
       "gap        float64\n",
       "ids         object\n",
       "mag        float64\n",
       "magType     object\n",
       "mmi        float64\n",
       "net         object\n",
       "nst        float64\n",
       "place       object\n",
       "rms        float64\n",
       "sig          int64\n",
       "sources     object\n",
       "status      object\n",
       "time         int64\n",
       "title       object\n",
       "tsunami      int64\n",
       "type        object\n",
       "types       object\n",
       "tz         float64\n",
       "updated      int64\n",
       "url         object\n",
       "dtype: object"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dtypes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Getting extra info and finding nulls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 9332 entries, 0 to 9331\n",
      "Data columns (total 26 columns):\n",
      "alert      59 non-null object\n",
      "cdi        329 non-null float64\n",
      "code       9332 non-null object\n",
      "detail     9332 non-null object\n",
      "dmin       6139 non-null float64\n",
      "felt       329 non-null float64\n",
      "gap        6164 non-null float64\n",
      "ids        9332 non-null object\n",
      "mag        9331 non-null float64\n",
      "magType    9331 non-null object\n",
      "mmi        93 non-null float64\n",
      "net        9332 non-null object\n",
      "nst        5364 non-null float64\n",
      "place      9332 non-null object\n",
      "rms        9332 non-null float64\n",
      "sig        9332 non-null int64\n",
      "sources    9332 non-null object\n",
      "status     9332 non-null object\n",
      "time       9332 non-null int64\n",
      "title      9332 non-null object\n",
      "tsunami    9332 non-null int64\n",
      "type       9332 non-null object\n",
      "types      9332 non-null object\n",
      "tz         9331 non-null float64\n",
      "updated    9332 non-null int64\n",
      "url        9332 non-null object\n",
      "dtypes: float64(9), int64(4), object(13)\n",
      "memory usage: 1.4+ MB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Describing and Summarizing\n",
    "### Get summary statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cdi</th>\n",
       "      <th>dmin</th>\n",
       "      <th>felt</th>\n",
       "      <th>gap</th>\n",
       "      <th>mag</th>\n",
       "      <th>mmi</th>\n",
       "      <th>nst</th>\n",
       "      <th>rms</th>\n",
       "      <th>sig</th>\n",
       "      <th>time</th>\n",
       "      <th>tsunami</th>\n",
       "      <th>tz</th>\n",
       "      <th>updated</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>329.000000</td>\n",
       "      <td>6139.000000</td>\n",
       "      <td>329.000000</td>\n",
       "      <td>6164.000000</td>\n",
       "      <td>9331.000000</td>\n",
       "      <td>93.000000</td>\n",
       "      <td>5364.000000</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9.332000e+03</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9331.000000</td>\n",
       "      <td>9.332000e+03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>2.754711</td>\n",
       "      <td>0.544925</td>\n",
       "      <td>12.310030</td>\n",
       "      <td>121.506588</td>\n",
       "      <td>1.497345</td>\n",
       "      <td>3.651398</td>\n",
       "      <td>19.053878</td>\n",
       "      <td>0.362122</td>\n",
       "      <td>56.899914</td>\n",
       "      <td>1.538284e+12</td>\n",
       "      <td>0.006537</td>\n",
       "      <td>-451.990140</td>\n",
       "      <td>1.538537e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.010637</td>\n",
       "      <td>2.214305</td>\n",
       "      <td>48.954944</td>\n",
       "      <td>72.962363</td>\n",
       "      <td>1.203347</td>\n",
       "      <td>1.790523</td>\n",
       "      <td>15.492315</td>\n",
       "      <td>0.317784</td>\n",
       "      <td>91.872163</td>\n",
       "      <td>6.080306e+08</td>\n",
       "      <td>0.080589</td>\n",
       "      <td>231.752571</td>\n",
       "      <td>6.564135e+08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000648</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12.000000</td>\n",
       "      <td>-1.260000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.537229e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-720.000000</td>\n",
       "      <td>1.537230e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>0.020425</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>66.142500</td>\n",
       "      <td>0.720000</td>\n",
       "      <td>2.680000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>0.119675</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>1.537793e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-540.000000</td>\n",
       "      <td>1.537996e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>2.700000</td>\n",
       "      <td>0.059050</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>105.000000</td>\n",
       "      <td>1.300000</td>\n",
       "      <td>3.720000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>0.210000</td>\n",
       "      <td>26.000000</td>\n",
       "      <td>1.538245e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-480.000000</td>\n",
       "      <td>1.538621e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>3.300000</td>\n",
       "      <td>0.177250</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>159.000000</td>\n",
       "      <td>1.900000</td>\n",
       "      <td>4.570000</td>\n",
       "      <td>25.000000</td>\n",
       "      <td>0.590000</td>\n",
       "      <td>56.000000</td>\n",
       "      <td>1.538766e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-480.000000</td>\n",
       "      <td>1.539110e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>8.400000</td>\n",
       "      <td>53.737000</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>355.910000</td>\n",
       "      <td>7.500000</td>\n",
       "      <td>9.120000</td>\n",
       "      <td>172.000000</td>\n",
       "      <td>1.910000</td>\n",
       "      <td>2015.000000</td>\n",
       "      <td>1.539475e+12</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>720.000000</td>\n",
       "      <td>1.539537e+12</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              cdi         dmin        felt          gap          mag  \\\n",
       "count  329.000000  6139.000000  329.000000  6164.000000  9331.000000   \n",
       "mean     2.754711     0.544925   12.310030   121.506588     1.497345   \n",
       "std      1.010637     2.214305   48.954944    72.962363     1.203347   \n",
       "min      0.000000     0.000648    0.000000    12.000000    -1.260000   \n",
       "25%      2.000000     0.020425    1.000000    66.142500     0.720000   \n",
       "50%      2.700000     0.059050    2.000000   105.000000     1.300000   \n",
       "75%      3.300000     0.177250    5.000000   159.000000     1.900000   \n",
       "max      8.400000    53.737000  580.000000   355.910000     7.500000   \n",
       "\n",
       "             mmi          nst          rms          sig          time  \\\n",
       "count  93.000000  5364.000000  9332.000000  9332.000000  9.332000e+03   \n",
       "mean    3.651398    19.053878     0.362122    56.899914  1.538284e+12   \n",
       "std     1.790523    15.492315     0.317784    91.872163  6.080306e+08   \n",
       "min     0.000000     0.000000     0.000000     0.000000  1.537229e+12   \n",
       "25%     2.680000     8.000000     0.119675     8.000000  1.537793e+12   \n",
       "50%     3.720000    15.000000     0.210000    26.000000  1.538245e+12   \n",
       "75%     4.570000    25.000000     0.590000    56.000000  1.538766e+12   \n",
       "max     9.120000   172.000000     1.910000  2015.000000  1.539475e+12   \n",
       "\n",
       "           tsunami           tz       updated  \n",
       "count  9332.000000  9331.000000  9.332000e+03  \n",
       "mean      0.006537  -451.990140  1.538537e+12  \n",
       "std       0.080589   231.752571  6.564135e+08  \n",
       "min       0.000000  -720.000000  1.537230e+12  \n",
       "25%       0.000000  -540.000000  1.537996e+12  \n",
       "50%       0.000000  -480.000000  1.538621e+12  \n",
       "75%       0.000000  -480.000000  1.539110e+12  \n",
       "max       1.000000   720.000000  1.539537e+12  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Specifying the 5th and 95th percentile:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cdi</th>\n",
       "      <th>dmin</th>\n",
       "      <th>felt</th>\n",
       "      <th>gap</th>\n",
       "      <th>mag</th>\n",
       "      <th>mmi</th>\n",
       "      <th>nst</th>\n",
       "      <th>rms</th>\n",
       "      <th>sig</th>\n",
       "      <th>time</th>\n",
       "      <th>tsunami</th>\n",
       "      <th>tz</th>\n",
       "      <th>updated</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>329.000000</td>\n",
       "      <td>6139.000000</td>\n",
       "      <td>329.000000</td>\n",
       "      <td>6164.000000</td>\n",
       "      <td>9331.000000</td>\n",
       "      <td>93.000000</td>\n",
       "      <td>5364.000000</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9.332000e+03</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9331.000000</td>\n",
       "      <td>9.332000e+03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>2.754711</td>\n",
       "      <td>0.544925</td>\n",
       "      <td>12.310030</td>\n",
       "      <td>121.506588</td>\n",
       "      <td>1.497345</td>\n",
       "      <td>3.651398</td>\n",
       "      <td>19.053878</td>\n",
       "      <td>0.362122</td>\n",
       "      <td>56.899914</td>\n",
       "      <td>1.538284e+12</td>\n",
       "      <td>0.006537</td>\n",
       "      <td>-451.990140</td>\n",
       "      <td>1.538537e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.010637</td>\n",
       "      <td>2.214305</td>\n",
       "      <td>48.954944</td>\n",
       "      <td>72.962363</td>\n",
       "      <td>1.203347</td>\n",
       "      <td>1.790523</td>\n",
       "      <td>15.492315</td>\n",
       "      <td>0.317784</td>\n",
       "      <td>91.872163</td>\n",
       "      <td>6.080306e+08</td>\n",
       "      <td>0.080589</td>\n",
       "      <td>231.752571</td>\n",
       "      <td>6.564135e+08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000648</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12.000000</td>\n",
       "      <td>-1.260000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.537229e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-720.000000</td>\n",
       "      <td>1.537230e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5%</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>0.005491</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>35.000000</td>\n",
       "      <td>-0.040000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>0.030000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.537344e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-600.000000</td>\n",
       "      <td>1.537387e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>2.700000</td>\n",
       "      <td>0.059050</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>105.000000</td>\n",
       "      <td>1.300000</td>\n",
       "      <td>3.720000</td>\n",
       "      <td>15.000000</td>\n",
       "      <td>0.210000</td>\n",
       "      <td>26.000000</td>\n",
       "      <td>1.538245e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-480.000000</td>\n",
       "      <td>1.538621e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95%</th>\n",
       "      <td>4.300000</td>\n",
       "      <td>2.678900</td>\n",
       "      <td>40.200000</td>\n",
       "      <td>276.000000</td>\n",
       "      <td>4.400000</td>\n",
       "      <td>6.380000</td>\n",
       "      <td>49.000000</td>\n",
       "      <td>0.960000</td>\n",
       "      <td>298.000000</td>\n",
       "      <td>1.539319e+12</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>-60.000000</td>\n",
       "      <td>1.539400e+12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>8.400000</td>\n",
       "      <td>53.737000</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>355.910000</td>\n",
       "      <td>7.500000</td>\n",
       "      <td>9.120000</td>\n",
       "      <td>172.000000</td>\n",
       "      <td>1.910000</td>\n",
       "      <td>2015.000000</td>\n",
       "      <td>1.539475e+12</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>720.000000</td>\n",
       "      <td>1.539537e+12</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              cdi         dmin        felt          gap          mag  \\\n",
       "count  329.000000  6139.000000  329.000000  6164.000000  9331.000000   \n",
       "mean     2.754711     0.544925   12.310030   121.506588     1.497345   \n",
       "std      1.010637     2.214305   48.954944    72.962363     1.203347   \n",
       "min      0.000000     0.000648    0.000000    12.000000    -1.260000   \n",
       "5%       2.000000     0.005491    1.000000    35.000000    -0.040000   \n",
       "50%      2.700000     0.059050    2.000000   105.000000     1.300000   \n",
       "95%      4.300000     2.678900   40.200000   276.000000     4.400000   \n",
       "max      8.400000    53.737000  580.000000   355.910000     7.500000   \n",
       "\n",
       "             mmi          nst          rms          sig          time  \\\n",
       "count  93.000000  5364.000000  9332.000000  9332.000000  9.332000e+03   \n",
       "mean    3.651398    19.053878     0.362122    56.899914  1.538284e+12   \n",
       "std     1.790523    15.492315     0.317784    91.872163  6.080306e+08   \n",
       "min     0.000000     0.000000     0.000000     0.000000  1.537229e+12   \n",
       "5%      0.000000     4.000000     0.030000     0.000000  1.537344e+12   \n",
       "50%     3.720000    15.000000     0.210000    26.000000  1.538245e+12   \n",
       "95%     6.380000    49.000000     0.960000   298.000000  1.539319e+12   \n",
       "max     9.120000   172.000000     1.910000  2015.000000  1.539475e+12   \n",
       "\n",
       "           tsunami           tz       updated  \n",
       "count  9332.000000  9331.000000  9.332000e+03  \n",
       "mean      0.006537  -451.990140  1.538537e+12  \n",
       "std       0.080589   231.752571  6.564135e+08  \n",
       "min       0.000000  -720.000000  1.537230e+12  \n",
       "5%        0.000000  -600.000000  1.537387e+12  \n",
       "50%       0.000000  -480.000000  1.538621e+12  \n",
       "95%       0.000000   -60.000000  1.539400e+12  \n",
       "max       1.000000   720.000000  1.539537e+12  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe(percentiles=[0.05, 0.95])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Describe specific data types:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>alert</th>\n",
       "      <th>code</th>\n",
       "      <th>detail</th>\n",
       "      <th>ids</th>\n",
       "      <th>magType</th>\n",
       "      <th>net</th>\n",
       "      <th>place</th>\n",
       "      <th>sources</th>\n",
       "      <th>status</th>\n",
       "      <th>title</th>\n",
       "      <th>type</th>\n",
       "      <th>types</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>59</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9331</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>unique</th>\n",
       "      <td>2</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>10</td>\n",
       "      <td>14</td>\n",
       "      <td>5433</td>\n",
       "      <td>52</td>\n",
       "      <td>2</td>\n",
       "      <td>7807</td>\n",
       "      <td>5</td>\n",
       "      <td>42</td>\n",
       "      <td>9332</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>top</th>\n",
       "      <td>green</td>\n",
       "      <td>73091366</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>,ak20260343,</td>\n",
       "      <td>ml</td>\n",
       "      <td>ak</td>\n",
       "      <td>10km NE of Aguanga, CA</td>\n",
       "      <td>,ak,</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>M 0.4 - 10km NE of Aguanga, CA</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,geoserve,origin,phase-data,</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>freq</th>\n",
       "      <td>58</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>6803</td>\n",
       "      <td>3166</td>\n",
       "      <td>306</td>\n",
       "      <td>2981</td>\n",
       "      <td>7797</td>\n",
       "      <td>55</td>\n",
       "      <td>9081</td>\n",
       "      <td>5301</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        alert      code                                             detail  \\\n",
       "count      59      9332                                               9332   \n",
       "unique      2      9332                                               9332   \n",
       "top     green  73091366  https://earthquake.usgs.gov/fdsnws/event/1/que...   \n",
       "freq       58         1                                                  1   \n",
       "\n",
       "                 ids magType   net                   place sources    status  \\\n",
       "count           9332    9331  9332                    9332    9332      9332   \n",
       "unique          9332      10    14                    5433      52         2   \n",
       "top     ,ak20260343,      ml    ak  10km NE of Aguanga, CA    ,ak,  reviewed   \n",
       "freq               1    6803  3166                     306    2981      7797   \n",
       "\n",
       "                                 title        type  \\\n",
       "count                             9332        9332   \n",
       "unique                            7807           5   \n",
       "top     M 0.4 - 10km NE of Aguanga, CA  earthquake   \n",
       "freq                                55        9081   \n",
       "\n",
       "                               types  \\\n",
       "count                           9332   \n",
       "unique                            42   \n",
       "top     ,geoserve,origin,phase-data,   \n",
       "freq                            5301   \n",
       "\n",
       "                                                      url  \n",
       "count                                                9332  \n",
       "unique                                               9332  \n",
       "top     https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "freq                                                    1  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe(include=np.object)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Or describe all of them:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>alert</th>\n",
       "      <th>cdi</th>\n",
       "      <th>code</th>\n",
       "      <th>detail</th>\n",
       "      <th>dmin</th>\n",
       "      <th>felt</th>\n",
       "      <th>gap</th>\n",
       "      <th>ids</th>\n",
       "      <th>mag</th>\n",
       "      <th>magType</th>\n",
       "      <th>...</th>\n",
       "      <th>sources</th>\n",
       "      <th>status</th>\n",
       "      <th>time</th>\n",
       "      <th>title</th>\n",
       "      <th>tsunami</th>\n",
       "      <th>type</th>\n",
       "      <th>types</th>\n",
       "      <th>tz</th>\n",
       "      <th>updated</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>59</td>\n",
       "      <td>329.000000</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>6139.000000</td>\n",
       "      <td>329.000000</td>\n",
       "      <td>6164.000000</td>\n",
       "      <td>9332</td>\n",
       "      <td>9331.000000</td>\n",
       "      <td>9331</td>\n",
       "      <td>...</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9.332000e+03</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332.000000</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>9331.000000</td>\n",
       "      <td>9.332000e+03</td>\n",
       "      <td>9332</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>unique</th>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9332</td>\n",
       "      <td>9332</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9332</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10</td>\n",
       "      <td>...</td>\n",
       "      <td>52</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7807</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5</td>\n",
       "      <td>42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9332</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>top</th>\n",
       "      <td>green</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73091366</td>\n",
       "      <td>https://earthquake.usgs.gov/fdsnws/event/1/que...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>,ak20260343,</td>\n",
       "      <td>NaN</td>\n",
       "      <td>ml</td>\n",
       "      <td>...</td>\n",
       "      <td>,ak,</td>\n",
       "      <td>reviewed</td>\n",
       "      <td>NaN</td>\n",
       "      <td>M 0.4 - 10km NE of Aguanga, CA</td>\n",
       "      <td>NaN</td>\n",
       "      <td>earthquake</td>\n",
       "      <td>,geoserve,origin,phase-data,</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>https://earthquake.usgs.gov/earthquakes/eventp...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>freq</th>\n",
       "      <td>58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6803</td>\n",
       "      <td>...</td>\n",
       "      <td>2981</td>\n",
       "      <td>7797</td>\n",
       "      <td>NaN</td>\n",
       "      <td>55</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9081</td>\n",
       "      <td>5301</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>NaN</td>\n",
       "      <td>2.754711</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.544925</td>\n",
       "      <td>12.310030</td>\n",
       "      <td>121.506588</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.497345</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.538284e+12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.006537</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-451.990140</td>\n",
       "      <td>1.538537e+12</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>NaN</td>\n",
       "      <td>1.010637</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.214305</td>\n",
       "      <td>48.954944</td>\n",
       "      <td>72.962363</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.203347</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6.080306e+08</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.080589</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>231.752571</td>\n",
       "      <td>6.564135e+08</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000648</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-1.260000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.537229e+12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-720.000000</td>\n",
       "      <td>1.537230e+12</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>NaN</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.020425</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>66.142500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.720000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.537793e+12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-540.000000</td>\n",
       "      <td>1.537996e+12</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>NaN</td>\n",
       "      <td>2.700000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.059050</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>105.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.300000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.538245e+12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-480.000000</td>\n",
       "      <td>1.538621e+12</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>NaN</td>\n",
       "      <td>3.300000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.177250</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>159.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.900000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.538766e+12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>-480.000000</td>\n",
       "      <td>1.539110e+12</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>NaN</td>\n",
       "      <td>8.400000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>53.737000</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>355.910000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7.500000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.539475e+12</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>720.000000</td>\n",
       "      <td>1.539537e+12</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>11 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        alert         cdi      code  \\\n",
       "count      59  329.000000      9332   \n",
       "unique      2         NaN      9332   \n",
       "top     green         NaN  73091366   \n",
       "freq       58         NaN         1   \n",
       "mean      NaN    2.754711       NaN   \n",
       "std       NaN    1.010637       NaN   \n",
       "min       NaN    0.000000       NaN   \n",
       "25%       NaN    2.000000       NaN   \n",
       "50%       NaN    2.700000       NaN   \n",
       "75%       NaN    3.300000       NaN   \n",
       "max       NaN    8.400000       NaN   \n",
       "\n",
       "                                                   detail         dmin  \\\n",
       "count                                                9332  6139.000000   \n",
       "unique                                               9332          NaN   \n",
       "top     https://earthquake.usgs.gov/fdsnws/event/1/que...          NaN   \n",
       "freq                                                    1          NaN   \n",
       "mean                                                  NaN     0.544925   \n",
       "std                                                   NaN     2.214305   \n",
       "min                                                   NaN     0.000648   \n",
       "25%                                                   NaN     0.020425   \n",
       "50%                                                   NaN     0.059050   \n",
       "75%                                                   NaN     0.177250   \n",
       "max                                                   NaN    53.737000   \n",
       "\n",
       "              felt          gap           ids          mag magType  \\\n",
       "count   329.000000  6164.000000          9332  9331.000000    9331   \n",
       "unique         NaN          NaN          9332          NaN      10   \n",
       "top            NaN          NaN  ,ak20260343,          NaN      ml   \n",
       "freq           NaN          NaN             1          NaN    6803   \n",
       "mean     12.310030   121.506588           NaN     1.497345     NaN   \n",
       "std      48.954944    72.962363           NaN     1.203347     NaN   \n",
       "min       0.000000    12.000000           NaN    -1.260000     NaN   \n",
       "25%       1.000000    66.142500           NaN     0.720000     NaN   \n",
       "50%       2.000000   105.000000           NaN     1.300000     NaN   \n",
       "75%       5.000000   159.000000           NaN     1.900000     NaN   \n",
       "max     580.000000   355.910000           NaN     7.500000     NaN   \n",
       "\n",
       "                              ...                          sources    status  \\\n",
       "count                         ...                             9332      9332   \n",
       "unique                        ...                               52         2   \n",
       "top                           ...                             ,ak,  reviewed   \n",
       "freq                          ...                             2981      7797   \n",
       "mean                          ...                              NaN       NaN   \n",
       "std                           ...                              NaN       NaN   \n",
       "min                           ...                              NaN       NaN   \n",
       "25%                           ...                              NaN       NaN   \n",
       "50%                           ...                              NaN       NaN   \n",
       "75%                           ...                              NaN       NaN   \n",
       "max                           ...                              NaN       NaN   \n",
       "\n",
       "                time                           title      tsunami        type  \\\n",
       "count   9.332000e+03                            9332  9332.000000        9332   \n",
       "unique           NaN                            7807          NaN           5   \n",
       "top              NaN  M 0.4 - 10km NE of Aguanga, CA          NaN  earthquake   \n",
       "freq             NaN                              55          NaN        9081   \n",
       "mean    1.538284e+12                             NaN     0.006537         NaN   \n",
       "std     6.080306e+08                             NaN     0.080589         NaN   \n",
       "min     1.537229e+12                             NaN     0.000000         NaN   \n",
       "25%     1.537793e+12                             NaN     0.000000         NaN   \n",
       "50%     1.538245e+12                             NaN     0.000000         NaN   \n",
       "75%     1.538766e+12                             NaN     0.000000         NaN   \n",
       "max     1.539475e+12                             NaN     1.000000         NaN   \n",
       "\n",
       "                               types           tz       updated  \\\n",
       "count                           9332  9331.000000  9.332000e+03   \n",
       "unique                            42          NaN           NaN   \n",
       "top     ,geoserve,origin,phase-data,          NaN           NaN   \n",
       "freq                            5301          NaN           NaN   \n",
       "mean                             NaN  -451.990140  1.538537e+12   \n",
       "std                              NaN   231.752571  6.564135e+08   \n",
       "min                              NaN  -720.000000  1.537230e+12   \n",
       "25%                              NaN  -540.000000  1.537996e+12   \n",
       "50%                              NaN  -480.000000  1.538621e+12   \n",
       "75%                              NaN  -480.000000  1.539110e+12   \n",
       "max                              NaN   720.000000  1.539537e+12   \n",
       "\n",
       "                                                      url  \n",
       "count                                                9332  \n",
       "unique                                               9332  \n",
       "top     https://earthquake.usgs.gov/earthquakes/eventp...  \n",
       "freq                                                    1  \n",
       "mean                                                  NaN  \n",
       "std                                                   NaN  \n",
       "min                                                   NaN  \n",
       "25%                                                   NaN  \n",
       "50%                                                   NaN  \n",
       "75%                                                   NaN  \n",
       "max                                                   NaN  \n",
       "\n",
       "[11 rows x 26 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe(include='all')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This works on columns also:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    329.000000\n",
       "mean      12.310030\n",
       "std       48.954944\n",
       "min        0.000000\n",
       "25%        1.000000\n",
       "50%        2.000000\n",
       "75%        5.000000\n",
       "max      580.000000\n",
       "Name: felt, dtype: float64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.felt.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "There are methods for specific statistics as well. For example, finding the unique values in the `alert` column:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([nan, 'green', 'red'], dtype=object)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.alert.unique()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can then use `value_counts()` to see how many of each unique value we have:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "green    58\n",
       "red       1\n",
       "Name: alert, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.alert.value_counts()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
